link_directories(${CMAKE_BINARY_DIR}/${LIB_DIR})

set(STEP_SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/ap203.exp)
add_definitions(-DAP203)

generate_schema_inputs(${STEP_SCHEMA_FILE} stepg)

set(
  stepg_SOURCES
  ${express_srcs}
  ../BRLCADWrapper.cpp
  ../STEPWrapper.cpp
  AdvancedBrepShapeRepresentation.cpp
  AdvancedFace.cpp
  AmountOfSubstanceContextDependentUnit.cpp
  AmountOfSubstanceConversionBasedUnit.cpp
  AmountOfSubstanceSiUnit.cpp
  AmountOfSubstanceUnit.cpp
  ApplicationContext.cpp
  ApplicationContextElement.cpp
  AreaContextDependentUnit.cpp
  AreaConversionBasedUnit.cpp
  AreaSiUnit.cpp
  AreaUnit.cpp
  AssemblyComponentUsage.cpp
  Axis1Placement.cpp
  Axis2Placement.cpp
  Axis2Placement2D.cpp
  Axis2Placement3D.cpp
  BSplineCurve.cpp
  BSplineCurveWithKnots.cpp
  BSplineSurface.cpp
  BSplineSurfaceWithKnots.cpp
  BezierCurve.cpp
  BezierSurface.cpp
  BoundaryCurve.cpp
  BoundedCurve.cpp
  BoundedPCurve.cpp
  BoundedSurface.cpp
  BoundedSurfaceCurve.cpp
  BrepWithVoids.cpp
  CartesianPoint.cpp
  CartesianTransformationOperator.cpp
  CartesianTransformationOperator2D.cpp
  CartesianTransformationOperator3D.cpp
  CharacterizedDefinition.cpp
  CharacterizedProductDefinition.cpp
  Circle.cpp
  ClosedShell.cpp
  CompositeCurve.cpp
  CompositeCurveOnSurface.cpp
  CompositeCurveSegment.cpp
  Conic.cpp
  ConicalSurface.cpp
  ConnectedFaceSet.cpp
  ContextDependentShapeRepresentation.cpp
  ContextDependentUnit.cpp
  ConversionBasedUnit.cpp
  Curve.cpp
  CurveBoundedSurface.cpp
  CurveReplica.cpp
  CylindricalSurface.cpp
  DefinitionalRepresentation.cpp
  DerivedUnit.cpp
  DerivedUnitElement.cpp
  DesignContext.cpp
  DimensionalExponents.cpp
  Direction.cpp
  Edge.cpp
  EdgeCurve.cpp
  EdgeLoop.cpp
  ElectricCurrentContextDependentUnit.cpp
  ElectricCurrentConversionBasedUnit.cpp
  ElectricCurrentSiUnit.cpp
  ElectricCurrentUnit.cpp
  ElementarySurface.cpp
  Ellipse.cpp
  Face.cpp
  FaceBound.cpp
  FaceOuterBound.cpp
  FaceSurface.cpp
  Factory.cpp
  FoundedItem.cpp
  FunctionallyDefinedTransformation.cpp
  GeometricallyBoundedSurfaceShapeRepresentation.cpp
  GeometricRepresentationContext.cpp
  GeometricRepresentationItem.cpp
  GeometricSet.cpp
  GeometricSetSelect.cpp
  GlobalUncertaintyAssignedContext.cpp
  GlobalUnitAssignedContext.cpp
  Hyperbola.cpp
  IntersectionCurve.cpp
  ItemDefinedTransformation.cpp
  LengthContextDependentUnit.cpp
  LengthConversionBasedUnit.cpp
  LengthMeasureWithUnit.cpp
  LengthSiUnit.cpp
  LengthUnit.cpp
  Line.cpp
  LocalUnits.cpp
  Loop.cpp
  LuminousIntensityContextDependentUnit.cpp
  LuminousIntensityConversionBasedUnit.cpp
  LuminousIntensitySiUnit.cpp
  LuminousIntensityUnit.cpp
  ManifoldSolidBrep.cpp
  ManifoldSurfaceShapeRepresentation.cpp
  MassContextDependentUnit.cpp
  MassConversionBasedUnit.cpp
  MassSiUnit.cpp
  MassUnit.cpp
  MeasureValue.cpp
  MeasureWithUnit.cpp
  MechanicalContext.cpp
  NamedUnit.cpp
  NextAssemblyUsageOccurrence.cpp
  OffsetCurve2D.cpp
  OffsetCurve3D.cpp
  OffsetSurface.cpp
  OpenNurbsInterfaces.cpp
  OpenShell.cpp
  OrientedClosedShell.cpp
  OrientedEdge.cpp
  OrientedFace.cpp
  PCurve.cpp
  PCurveOrSurface.cpp
  Parabola.cpp
  ParametricRepresentationContext.cpp
  Path.cpp
  Placement.cpp
  Plane.cpp
  PlaneAngleContextDependentUnit.cpp
  PlaneAngleConversionBasedUnit.cpp
  PlaneAngleMeasureWithUnit.cpp
  PlaneAngleSiUnit.cpp
  PlaneAngleUnit.cpp
  Point.cpp
  Polyline.cpp
  Product.cpp
  ProductCategory.cpp
  ProductContext.cpp
  ProductDefinition.cpp
  ProductDefinitionContext.cpp
  ProductDefinitionContextAssociation.cpp
  ProductDefinitionContextRole.cpp
  ProductDefinitionFormation.cpp
  ProductDefinitionFormationWithSpecifiedSource.cpp
  ProductDefinitionRelationship.cpp
  ProductDefinitionShape.cpp
  ProductDefinitionUsage.cpp
  ProductDefinitionWithAssociatedDocuments.cpp
  ProductRelatedProductCategory.cpp
  PropertyDefinition.cpp
  PropertyDefinitionRepresentation.cpp
  QuasiUniformCurve.cpp
  QuasiUniformSurface.cpp
  RatioContextDependentUnit.cpp
  RatioConversionBasedUnit.cpp
  RatioSiUnit.cpp
  RatioUnit.cpp
  RationalBSplineCurve.cpp
  RationalBSplineCurveWithKnots.cpp
  RationalBSplineSurface.cpp
  RationalBSplineSurfaceWithKnots.cpp
  RationalBezierCurve.cpp
  RationalBezierSurface.cpp
  RationalQuasiUniformCurve.cpp
  RationalQuasiUniformSurface.cpp
  RationalUniformCurve.cpp
  RationalUniformSurface.cpp
  RectangularCompositeSurface.cpp
  RectangularTrimmedSurface.cpp
  Representation.cpp
  RepresentationContext.cpp
  RepresentationItem.cpp
  RepresentationRelationship.cpp
  RepresentationRelationshipWithTransformation.cpp
  RepresentedDefinition.cpp
  STEPEntity.cpp
  SeamCurve.cpp
  ShapeAspect.cpp
  ShapeAspectRelationship.cpp
  ShapeDefinition.cpp
  ShapeDefinitionRepresentation.cpp
  ShapeRepresentation.cpp
  ShapeRepresentationRelationship.cpp
  ShellBasedSurfaceModel.cpp
  SiUnit.cpp
  SolidAngleContextDependentUnit.cpp
  SolidAngleConversionBasedUnit.cpp
  SolidAngleSiUnit.cpp
  SolidAngleUnit.cpp
  SolidModel.cpp
  SphericalSurface.cpp
  Surface.cpp
  SurfaceCurve.cpp
  SurfaceOfLinearExtrusion.cpp
  SurfaceOfRevolution.cpp
  SurfacePatch.cpp
  SurfaceReplica.cpp
  SweptSurface.cpp
  ThermodynamicTemperatureContextDependentUnit.cpp
  ThermodynamicTemperatureConversionBasedUnit.cpp
  ThermodynamicTemperatureSiUnit.cpp
  ThermodynamicTemperatureUnit.cpp
  TimeContextDependentUnit.cpp
  TimeConversionBasedUnit.cpp
  TimeSiUnit.cpp
  TimeUnit.cpp
  TopologicalRepresentationItem.cpp
  ToroidalSurface.cpp
  Transformation.cpp
  TrimmedCurve.cpp
  TrimmingSelect.cpp
  UncertaintyMeasureWithUnit.cpp
  UniformCurve.cpp
  UniformSurface.cpp
  Unit.cpp
  Vector.cpp
  Vertex.cpp
  VertexLoop.cpp
  VertexPoint.cpp
  VolumeContextDependentUnit.cpp
  VolumeConversionBasedUnit.cpp
  VolumeSiUnit.cpp
  VolumeUnit.cpp
  step-g.cpp
)
cmakefiles(${stepg_SOURCES})

set(
  stepg_HDRS
  AdvancedBrepShapeRepresentation.h
  AdvancedFace.h
  AmountOfSubstanceContextDependentUnit.h
  AmountOfSubstanceConversionBasedUnit.h
  AmountOfSubstanceSiUnit.h
  AmountOfSubstanceUnit.h
  ApplicationContext.h
  ApplicationContextElement.h
  AreaContextDependentUnit.h
  AreaConversionBasedUnit.h
  AreaSiUnit.h
  AreaUnit.h
  AssemblyComponentUsage.h
  Axis1Placement.h
  Axis2Placement.h
  Axis2Placement2D.h
  Axis2Placement3D.h
  BSplineCurve.h
  BSplineCurveWithKnots.h
  BSplineSurface.h
  BSplineSurfaceWithKnots.h
  BezierCurve.h
  BezierSurface.h
  BoundaryCurve.h
  BoundedCurve.h
  BoundedPCurve.h
  BoundedSurface.h
  BoundedSurfaceCurve.h
  BrepWithVoids.h
  CartesianPoint.h
  CartesianTransformationOperator.h
  CartesianTransformationOperator2D.h
  CartesianTransformationOperator3D.h
  CharacterizedDefinition.h
  CharacterizedProductDefinition.h
  Circle.h
  ClosedShell.h
  CompositeCurve.h
  CompositeCurveOnSurface.h
  CompositeCurveSegment.h
  Conic.h
  ConicalSurface.h
  ConnectedFaceSet.h
  ContextDependentShapeRepresentation.h
  ContextDependentUnit.h
  ConversionBasedUnit.h
  Curve.h
  CurveBoundedSurface.h
  CurveReplica.h
  CylindricalSurface.h
  DefinitionalRepresentation.h
  DerivedUnit.h
  DerivedUnitElement.h
  DesignContext.h
  DimensionalExponents.h
  Direction.h
  Edge.h
  EdgeCurve.h
  EdgeLoop.h
  ElectricCurrentContextDependentUnit.h
  ElectricCurrentConversionBasedUnit.h
  ElectricCurrentSiUnit.h
  ElectricCurrentUnit.h
  ElementarySurface.h
  Ellipse.h
  Face.h
  FaceBound.h
  FaceOuterBound.h
  FaceSurface.h
  Factory.h
  FoundedItem.h
  FunctionallyDefinedTransformation.h
  GeometricallyBoundedSurfaceShapeRepresentation.h
  GeometricRepresentationContext.h
  GeometricRepresentationItem.h
  GeometricSet.h
  GeometricSetSelect.h
  GlobalUncertaintyAssignedContext.h
  GlobalUnitAssignedContext.h
  Hyperbola.h
  IntersectionCurve.h
  ItemDefinedTransformation.h
  LengthContextDependentUnit.h
  LengthConversionBasedUnit.h
  LengthMeasureWithUnit.h
  LengthSiUnit.h
  LengthUnit.h
  Line.h
  LocalUnits.h
  Loop.h
  LuminousIntensityContextDependentUnit.h
  LuminousIntensityConversionBasedUnit.h
  LuminousIntensitySiUnit.h
  LuminousIntensityUnit.h
  ManifoldSolidBrep.h
  ManifoldSurfaceShapeRepresentation.h
  MassContextDependentUnit.h
  MassConversionBasedUnit.h
  MassSiUnit.h
  MassUnit.h
  MeasureValue.h
  MeasureWithUnit.h
  MechanicalContext.h
  NamedUnit.h
  NextAssemblyUsageOccurrence.h
  OffsetCurve2D.h
  OffsetCurve3D.h
  OffsetSurface.h
  OpenShell.h
  OrientedClosedShell.h
  OrientedEdge.h
  OrientedFace.h
  PCurve.h
  PCurveOrSurface.h
  Parabola.h
  ParametricRepresentationContext.h
  Path.h
  Placement.h
  Plane.h
  PlaneAngleContextDependentUnit.h
  PlaneAngleConversionBasedUnit.h
  PlaneAngleMeasureWithUnit.h
  PlaneAngleSiUnit.h
  PlaneAngleUnit.h
  Point.h
  Polyline.h
  Product.h
  ProductCategory.h
  ProductContext.h
  ProductDefinition.h
  ProductDefinitionContext.h
  ProductDefinitionContextAssociation.h
  ProductDefinitionContextRole.h
  ProductDefinitionFormation.h
  ProductDefinitionFormationWithSpecifiedSource.h
  ProductDefinitionRelationship.h
  ProductDefinitionShape.h
  ProductDefinitionUsage.h
  ProductDefinitionWithAssociatedDocuments.h
  ProductRelatedProductCategory.h
  PropertyDefinition.h
  PropertyDefinitionRepresentation.h
  QuasiUniformCurve.h
  QuasiUniformSurface.h
  RatioContextDependentUnit.h
  RatioConversionBasedUnit.h
  RatioSiUnit.h
  RatioUnit.h
  RationalBSplineCurve.h
  RationalBSplineCurveWithKnots.h
  RationalBSplineSurface.h
  RationalBSplineSurfaceWithKnots.h
  RationalBezierCurve.h
  RationalBezierSurface.h
  RationalQuasiUniformCurve.h
  RationalQuasiUniformSurface.h
  RationalUniformCurve.h
  RationalUniformSurface.h
  RectangularCompositeSurface.h
  RectangularTrimmedSurface.h
  Representation.h
  RepresentationContext.h
  RepresentationItem.h
  RepresentationRelationship.h
  RepresentationRelationshipWithTransformation.h
  RepresentedDefinition.h
  STEPEntity.h
  SeamCurve.h
  ShapeAspect.h
  ShapeAspectRelationship.h
  ShapeDefinition.h
  ShapeDefinitionRepresentation.h
  ShapeRepresentation.h
  ShapeRepresentationRelationship.h
  ShellBasedSurfaceModel.h
  SiUnit.h
  SolidAngleContextDependentUnit.h
  SolidAngleConversionBasedUnit.h
  SolidAngleSiUnit.h
  SolidAngleUnit.h
  SolidModel.h
  SphericalSurface.h
  Surface.h
  SurfaceCurve.h
  SurfaceOfLinearExtrusion.h
  SurfaceOfRevolution.h
  SurfacePatch.h
  SurfaceReplica.h
  SweptSurface.h
  ThermodynamicTemperatureContextDependentUnit.h
  ThermodynamicTemperatureConversionBasedUnit.h
  ThermodynamicTemperatureSiUnit.h
  ThermodynamicTemperatureUnit.h
  TimeContextDependentUnit.h
  TimeConversionBasedUnit.h
  TimeSiUnit.h
  TimeUnit.h
  TopologicalRepresentationItem.h
  ToroidalSurface.h
  Transformation.h
  TrimmedCurve.h
  TrimmingSelect.h
  UncertaintyMeasureWithUnit.h
  UniformCurve.h
  UniformSurface.h
  Unit.h
  Vector.h
  Vertex.h
  VertexLoop.h
  VertexPoint.h
  VolumeContextDependentUnit.h
  VolumeConversionBasedUnit.h
  VolumeSiUnit.h
  VolumeUnit.h
)
cmakefiles(${stepg_HDRS})

if(BRLCAD_ENABLE_STEP)
  set(
    stepg_LIBS
    libwdb
    librt
    libbu
    libbrep
    ${STEPCODE_UTILS_LIBRARY}
    ${STEPCODE_EDITOR_LIBRARY}
    ${STEPCODE_DAI_LIBRARY}
    ${STEPCODE_CORE_LIBRARY}
    ${OPENNURBS_LIBRARIES}
  )

  set(
    AP203_INCLUDE_DIRS
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/..
    ${STEPCODE_INCLUDE_DIRS}
    ${CMAKE_SOURCE_DIR}/src/libbrep # for PullbackCurve.h
  )

  # We have the PRECOMILE_HEADER that includes the generated stepcode
  # outputs - add our fixed headers as well:
  foreach(header ${stepg_HDRS})
    # Use relative include for portability
    get_filename_component(header_name "${header}" NAME)
    file(APPEND "${PRECOMPILE_HEADER}" "#include \"${header_name}\"\n")
  endforeach()

  brlcad_addexec(step-g "${stepg_SOURCES}" "${stepg_LIBS}" NO_STRICT FOLDER Conv)
  target_precompile_headers(step-g PRIVATE "${PRECOMPILE_HEADER}")
  target_include_directories(step-g BEFORE PRIVATE ${AP203_INCLUDE_DIRS})
  add_dependencies(step-g step-express-${SCHEMA_NAME}-stepg)
  set_property(TARGET step-g APPEND PROPERTY INCLUDE_DIRECTORIES "${stepg_SCHEMA_OUT_DIR}")
  target_compile_definitions(step-g PRIVATE SC_SCHEMA_DLL_EXPORTS)

  if(HIDE_INTERNAL_SYMBOLS)
    set(
      SCIMPORTS
      SC_CORE_DLL_IMPORTS
      SC_DAI_DLL_IMPORTS
      SC_EDITOR_DLL_IMPORTS
      SC_UTILS_DLL_IMPORTS
      OPENNURBS_IMPORTS
    )
    foreach(scp ${SCIMPORTS})
      set_property(TARGET step-g APPEND PROPERTY COMPILE_DEFINITIONS "${scp}")
    endforeach(scp ${SCIMPORTS})
  endif(HIDE_INTERNAL_SYMBOLS)
endif(BRLCAD_ENABLE_STEP)

cmakefiles(
  CMakeLists.txt
  ap203.exp
)

# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
